# name : surv.power.event.fun power|events, ttepower
# key: surv.power.event.fun
# contributor: Shuguang Sun
# --
${1:ttepower} <- function(x) {
  hr0 <- 1
  zalpha <- qnorm(1 - x$alpha/x$sided)
  sd <- (1+x$ratio) / sqrt(x$events * x$ratio)
  zb <- (log(hr0/x$hr)/sd - zalpha)
  power <- pnorm(zb)
  power
}
$1(x)